<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <title>软件工程设计-后台管理中心</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="/layui/css/layui.css" rel="stylesheet">
    <style type="text/css">
        input::-webkit-outer-spin-button,
        input::-webkit-inner-spin-button {
            -webkit-appearance: none !important;
            margin: 0;
        }

        /* 火狐 */
        input[type="number"] {
            -moz-appearance: textfield;
        }
    </style>
</head>
<body onload="showData()">
<div class="layui-layout layui-layout-admin">
    <div th:replace="~{top::topHtml}"></div>
    <div th:replace="~{nav::navHtml}"></div>
    <div class="layui-body">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;">
            <blockquote class="layui-elem-quote layui-text">
                软件工程设计
            </blockquote>
            <div class="layui-card layui-panel">
                <form class="layui-form layui-form-pane" action="">
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">序号</label>
                            <div class="layui-input-block" id="stuNum">

                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">组号</label>
                            <div class="layui-input-inline" id="groupNum">

                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">姓名</label>
                            <div class="layui-input-block" id="stuName">

                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">学号</label>
                            <div class="layui-input-inline" id="stuIdNum">

                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-inline">
                            <label class="layui-form-label">年级</label>
                            <div class="layui-input-block" id="stuGrade">

                            </div>
                        </div>
                        <div class="layui-inline">
                            <label class="layui-form-label">班级</label>
                            <div class="layui-input-inline" id="stuClass">

                            </div>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">项目名称</label>
                        <div class="layui-input-block" id="projectName">

                        </div>
                    </div>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">项目任务</label>
                        <div class="layui-input-block" id="projectTask">

                        </div>
                    </div>
                    <div class="layui-form-item" id="basicScore">

                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">项目URL</label>
                        <div class="layui-input-block" id="projectUrl">

                        </div>
                    </div>
                    <!-- <div class="layui-form-item">
                        <label class="layui-form-label">选择框</label>
                        <div class="layui-input-inline">
                            <select name="interest" lay-filter="aihao">
                                <option value=""></option>
                                <option value="0">写作</option>
                                <option value="1" selected>阅读</option>
                                <option value="2">游戏</option>
                                <option value="3">音乐</option>
                                <option value="4">旅行</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">开关-默认开</label>
                        <div class="layui-input-block">
                            <input type="checkbox" checked name="open" lay-skin="switch" lay-filter="switchTest"
                                title="开关">
                        </div>
                    </div>
                    <div class="layui-form-item" pane>
                        <label class="layui-form-label">单选框</label>
                        <div class="layui-input-block">
                            <input type="radio" name="sex" value="男" title="男" checked>
                            <input type="radio" name="sex" value="女" title="女">
                            <input type="radio" name="sex" value="禁" title="禁用" disabled>
                        </div>
                    </div> -->
                    <!-- <div class="layui-form-item">
                        <button class="layui-btn" lay-submit lay-filter="demo2">确认</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div> -->
                </form>
            </div>
            <br><br>
        </div>
    </div>
    <div th:replace="~{footer::footerHtml}"></div>
</div>

<script src="/layui/layui.js"></script>
<script src="/encrypt/crypto-js.min.js"></script>
<script src="/encrypt/encrypt-key.js"></script>

<script type="text/javascript">
    function showScoreDetail(id) {
        localStorage.setItem("stuId", id)
    }
</script>


<script type="text/javascript">
    let stuId = localStorage.getItem("stuIdGetDetail");
    if (stuId == null) {
        window.location.href = "/ltj/stuInfoList"
    } else {
        function showData() {

            let $ = layui.$
            $.post("/ltj/getStudentDetailInfoByStudentId?stuId=" + stuId, function (res) {
                let resData = JSON.parse(decryptData(res.data))
                let allTask = JSON.parse(resData.allTask)

                let task = ""

                for (let i = 0; i < allTask.length; i++) {
                    task += i+1 + "、" +allTask[i].projectTask + "\n"
                }

                resData = JSON.parse(resData.allData)
                let stuNumHtml = ""
                stuNumHtml += '<input type = "text" name = "date" autocomplete = "off" value = "' + resData.stuNumber + '" readOnly class = "layui-input" >'
                $("#stuNum").html(stuNumHtml)

                let groupNumHtml = ""
                let score = Number(resData.groupNumber) === 0 ? "灰灰老师组" : Number(resData.groupNumber)
                groupNumHtml += '<input type="text" name="number" autocomplete="off" class="layui-input" value="' + score + '" readonly>'
                $("#groupNum").html(groupNumHtml)

                let stuNameHtml = ""
                stuNameHtml += '<input type="text" name="date"  autocomplete="off" value="' + resData.stuName + '" readonly class="layui-input">'
                $("#stuName").html(stuNameHtml)

                let stuIdNumHtml = ""
                stuIdNumHtml += '<input type="text" name="number" autocomplete="off" class="layui-input" value="' + resData.stuIdNumber + '" readonly>'
                $("#stuIdNum").html(stuIdNumHtml)

                let stuGradeHtml = ""
                stuGradeHtml += '<input type="text" name="date" id="date1" autocomplete="off" value="' + resData.classGrade + '" readonly class="layui-input">'
                $("#stuGrade").html(stuGradeHtml)

                let stuClassHtml = ""
                stuClassHtml += '<input type="text" name="number" autocomplete="off" class="layui-input" value="' + resData.className + '" readonly>'
                $("#stuClass").html(stuClassHtml)

                let projectNameHtml = ""
                projectNameHtml += '<input type="text" name="title" autocomplete="off" value="' + resData.projectName + '" readonly lay-verify="required" class="layui-input">'
                $("#projectName").html(projectNameHtml)

                let projectTaskHtml = ""
                projectTaskHtml += '<textarea class="layui-textarea" readonly>'+task+'</textarea>'
                $("#projectTask").html(projectTaskHtml)

                let basicScoreHtml = ""
                basicScoreHtml += '<div class="layui-inline">\n' +
                    '<label class="layui-form-label">基础分数</label>\n' +
                    '<div class="layui-input-inline" style="width: 100px;">\n' +
                    '<input type="number" name="price_min" autocomplete="off" value="' + resData.basicScore + '" readonly\n' +
                    'class="layui-input">\n' +
                    '</div>\n' +
                    '</div>\n' +
                    '<span style="cursor: pointer" onclick="showScoreDetail(' + resData.stuId + ')">\n' +
                    '<i class = \'layui-icon layui-icon-about\'></i>分数详情\n' +
                    '</span>'
                $("#basicScore").html(basicScoreHtml)

                let projectUrlHtml = ""
                projectUrlHtml += '<input type="text" name="title" autocomplete="off" style="width: 30%" value="' + resData.projectUrl + '" lay-verify="required" class="layui-input">'
                $("#projectUrl").html(projectUrlHtml)


            })
        }
    }
</script>


<script>
    layui.use(['form'], function () {
        var form = layui.form;
        var layer = layui.layer;
        // 提交事件
        form.on('submit(demo2)', function (data) {
            var field = data.field; // 获取表单字段值
            // 显示填写结果，仅作演示用
            layer.alert(JSON.stringify(field), {
                title: '当前填写的字段值'
            });
            // 此处可执行 Ajax 等操作
            // …
            return false; // 阻止默认 form 跳转
        });
    });
</script>


<script>
    //JS
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element;
        var layer = layui.layer;
        var util = layui.util;
        var $ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            menuLeft: function (othis) { // 左侧菜单事件
                layer.msg('展开左侧菜单的操作', {
                    icon: 0
                });
            },
            menuRight: function () { // 右侧菜单事件
                layer.open({
                    type: 1,
                    title: '更多',
                    content: '<div style="padding: 15px;">处理右侧面板的操作</div>',
                    area: ['260px', '100%'],
                    offset: 'rt', // 右上角
                    anim: 'slideLeft', // 从右侧抽屉滑出
                    shadeClose: true,
                    scrollbar: false
                });
            }
        });
    });
</script>
<script>
    let $ = layui.$

    function showScoreDetail(id) {
        localStorage.setItem("stuId", id)
        $.post("/ltj/getStudentInfoById?id=" + id, function (res) {
            let resData = JSON.parse(decryptData(res.data))
            layui.use(function () {
                var layer = layui.layer;
                layer.open({
                    type: 2,
                    title: '<i class=\'layui-icon layui-icon-username\'></i>' + resData.stuName + '的分数详情',
                    shadeClose: true,
                    maxmin: true, //开启最大化最小化按钮
                    area: ['600px', '260px'],
                    content: '/ltj/scoreDetail'
                });
            })
        });
    }
</script>
</body>
</html>